create external table jms_dm.dm_privacy_waybill_detail_dt 
(
subordinate_agent_code   string COMMENT '所属代理区code' ,
subordinate_agent_name   string COMMENT '所属代理区' ,
first_franchisee_code    string COMMENT '加盟商code' ,
first_franchisee_name                                     string COMMENT '加盟商' ,
code                                                      string COMMENT '网点编码' ,
name                                                      string COMMENT '网点名字' ,
waybill_no                                              string COMMENT '运单号' ,
scan_time                                               string COMMENT '签收/寄件时间' ,
customer_code                                           string COMMENT '客户编码' ,
customer_name                                           string COMMENT '客户名字' ,
deliver_later_user                                      string COMMENT '派件人员' ,
end_network_arrival_early_time       string COMMENT '末端网点到件时间' ,
outstore_later_storecode                                string COMMENT '最晚出库门店编码' ,
detailed_address                              string COMMENT '门店地址' ,
business_id                                string COMMENT '品牌ID' ,
business_name                              string COMMENT '品牌名字' ,
outstore_later_scansitecode                             string COMMENT '最后一次出库网点' ,
out_store_scan_time                                     string COMMENT '出库时间' ,
instore_later_scansitecode                              string COMMENT '最后一次入库网点' ,
instore_scan_time                                       string COMMENT '入库时间' ,
deliver_later_scansitecode                              string COMMENT '第一次派件网点' ,
deliver_scantime                                        string COMMENT '派件时间' ,
end_network_network_code                                string COMMENT '末端到件网点code' ,
sign_later_scantime                                      string COMMENT '签收时间' ,
deliver_pistol_id                                       string COMMENT '操作设备' ,
ordersource_code                                 string COMMENT '订单表订单来源code' ,
ordersource_name                                 string COMMENT '订单表订单来源名称' ,
phone_contact                                           string COMMENT '电联标识\ 1:是 0否',
date_time string comment'分区日期',
type2 int comment'类型 1寄件 2签收'
 )
comment '隐私面单明细'
PARTITIONED BY ( dt string COMMENT '时间分区',type1 int comment '类型')
stored as parquet
LOCATION '/dw/hive/jms_dm.db/external/dm_privacy_waybill_detail_dt'
TBLPROPERTIES (     'discover.partitions' = 'false',  'parquet.column.index.access' = 'true');

alter table jms_dm.dm_privacy_waybill_detail_dt add columns (
is_privacy  int comment '是否隐私面单'
,is_ali_order int comment'是否淘系'
    )cascade ;